<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>角色主页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<%@ include file="/WEB-INF/common.jsp"%>

<link href="${path }/resources/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="${path }/resources/css/animate.css" rel="stylesheet">
<link href="${path }/resources/css/style.css?v=4.1.0" rel="stylesheet">

<!--dataTables css样式-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/jquery.dataTables.min.css">
<!--DataTables button扩展-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/buttons.dataTables.min.css">
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/form.css">


</head>
<body class="gray-bg" style="">
<jsp:include page="/WEB-INF/loginCheck.jsp" />
	<div>
		<h1 style="margin-left:20px">添加人员账号</h1>
	</div>
	<!--添加的表单  -->
	<div id="" barclass="panel-body" style="margin-top: 30px">
		<%-- action="${path }/Enterprise/addEnterPerson.htm" method="post"  --%>
		<form data-parsley-validate class="form-horizontal form-label-left" >
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">单位名：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="name" required="required" class="form-control col-md-7 col-xs-12" required="required">
				</div>
			</div>

			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">地址<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<div id="distpicker5">
						<div class="form-group" id="province">
							<label class="sr-only" for="province">Province</label> <select
								class="form-control" id="province" name="province" ></select>
						</div>
						<div class="form-group" id="city">
							<label class="sr-only" for="city">City</label> <select
								class="form-control" id="city" name="city" ></select>
						</div>
						<div class="form-group" id="district">
							<label class="sr-only" for="district">District</label> <select
								class="form-control" id="district" name="area" ></select>
						</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">电话<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="phone_number" required="required" class="form-control col-md-7 col-xs-12" required="required">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">密码<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="password" required="required" class="form-control col-md-7 col-xs-12" required="required">
				</div>
			</div>
<!-- 			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">身份<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="personIdentity" class="selectpicker form-control" data-live-search="true" name="personIdentity" required="required">
						<option value="维保企业">维保企业</option>
					</select>
				</div>
			</div> -->
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">角色<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="roleId" class="selectpicker form-control" data-live-search="true" name="roleId" required="required">
		                <option value="10">消防支队</option>	         
					</select>
				</div>
			</div>
			<div class="form-group">
				
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="first-name">状态<span class="required">*</span>
				</label>
				<lable style="font-size:20px"><input value="开启" name="status" type="radio" required="required"  style="margin-left:80px;">开启</lable>
				<lable style="font-size:20px" ><input value="停止" name="status" type="radio" required="required"  style="margin-left:200px;">停止</lable>
			</div>
			<div class="form-group">
				<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3" >
					<button id="submit" type="button" class="btn btn-success">提交</button>
					<a href="${path }/Enterprise/getFirePersonList.htm" class="btn btn-primary" style="margin-left:500px;">返回</a>
				</div>
			</div>

		</form>

	</div>
	
  	<!--表格  -->
 	<div class="col-md-12 col-sm-12 col-xs-12" style="margin-top: 30px">
	

	</div>
 
 

		

	
	

	
	

	
	<!-- Peity-->
	<script src="${path }/resources/js/plugins/peity/jquery.peity.min.js"></script>
	
	<!-- Bootstrap table-->
	<script src="${path }/resources/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="${path }/resources/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

	<!-- 自定义js-->
	<script src="${path }/resources/js/content.js?v=1.0.0"></script>
	
	<!-- jQuery Validation plugin javascript-->
    <script src="${path }/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${path }/resources/js/plugins/validate/messages_zh.min.js"></script>
   
   	<!-- jQuery form  -->
    <script src="${path }/resources/js/jquery.form.min.js"></script>
    
    <!-- layer javascript -->
    <script src="${path }/resources/js/plugins/layer/layer.min.js"></script>
        <!-- 省市联动 -->
	<script src="${path }/resources/js/distpicker.data.js"></script>
	<script src="${path }/resources/js/distpicker.js"></script>
	<script src="${path }/resources/js/main.js"></script>
    
	<script type="text/javascript">
	$("#submit").click(function(){	
		var province = $("#province").find("option:selected").text();
		var city = $("#city").find("option:selected").text();
		var district = $("#district").find("option:selected").text();
		if(province == "选择省份")
		{
			alert("请选择省信息！");
		}
		else{
			var name = $("input[name='name']").val(); 
			var phone_number = $("input[name='age']").val();
			var password = $("input[name='password']").val();
			//var identity=document.getElementById("personIdentity").value;
			var roleId=document.getElementById("roleId").value;
			var status=$("input[name='status']:checked").val();
			$.ajax({
				url:"/firefighting/Enterprise/addEnterPerson.htm",
				type:'POST',
				dataType:'json',
	 			data:{
					name:name,
					phone_number:phone_number,
					password:password,
					//identity:identity,
					roleId:roleId,
					province:province,
					city:city,
					area:district,
					status:status,
					type:1
				},   
				success:function(data)
				{
					alert("请牢记您的登陆账号："+data.userName);
					window.location.href="/firefighting/Enterprise/getFirePersonList.htm";
				},
				
		        error:function(data)
		        {
		        	$("#example").html("");
		        	$.unblockUI();
		        	$(".tbody"). empty();
		        }
			});	
		}
		 
	});	
	
	</script>

</body>
</html>